package priv.bestbeat.reportcenter.core.mq;

import lombok.Data;
import priv.bestbeat.reportcenter.core.monitor.MonitorProxy;
import priv.bestbeat.reportcenter.core.monitor.Observable;

import javax.annotation.Resource;

/**
 * @author 张渠钦
 * @date 2022/4/24 17:04
 */
@Data
public abstract class MessageProxy<T extends Message> implements MessageHandleable<T> {

    private MonitorProxy monitorProxy;

    @Override
    public T sendWithMonitor(T message) throws Exception {


        Observable observable = monitorProxy.register(message.getPayload());

        T result = send(wrap(message,observable));

        return result;
    }

    protected T wrap(T message,Observable observable) {
        return (T)null;
    }

}
